import request from "@/utils/request.js";

// 微信授权登录
export function wxLogin(code) {
  return request({
    url: "/xcx/authorized",
    headers: {
      isToken: false,
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    method: "post",
    data: code,
  });
}
// 微信认证登录
export function xcxLogin(data) {
  return request({
    url: "/xcx/xcxLogin",
    headers: {
      isToken: false,
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    method: "post",
    data,
  });
}
// 发送短信验证码
export function captchaSms(data) {
  return request({
    url: "/xcx/captchaSms",
    headers: {
      isToken: false,
    },
    method: "get",
    params: data,
  });
}
// 小程序短信登录
export function smsLogin(data) {
  return request({
    url: "/xcx/smsLogin",
    headers: {
      isToken: false,
    },
    method: "post",
    data,
  });
}
// 获取用户详细信息
export function getInfo() {
  return request({
    url: "/xcx/getInfo",
    method: "get",
  });
}
// 关联门店
export function bindStore(data) {
  return request({
    url: "/xcx/setStore",
    method: "post",
    data,
  });
}
// 退出方法
export function logout() {
  return request({
    url: "/xcx/logout",
    method: "post",
  });
}

// 注销账号发送短息
export function captchaSmsOut(data) {
  return request({
    url: "/xcx/captchaSmsOut",
    method: "get",
    params: data,
  });
}

// 注销账号
export function writeOff(data) {
  return request({
    url: "/xcx/writeOff",
    method: "post",
      data,
  });
}

// 切换登录
export const cutLogin = (data) => {
  return request({
    url: "/xcx/xcxQhLogin",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data,
  });
}